#include <vector>
#include <set>
#include <iostream>
#include <unordered_map>
#include <numeric>

using namespace std;

int countSegments(string s) {
    int num = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] != 32){
            num++;
            while(s[i] != 32){
                if(i < s.size()-1){
                    i++;
                }else{
                    break;
                }
            }
        }
    }
    return num;
}

int main(){
    string s = "Hello, my name is John";
    int num = countSegments(s);
    cout << num << endl;
    return 0;
}